Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

141
Vistas
AlpineJs extract a specific value from select[option]

Assume I have a table services with columns:id,name,price and I have made select box in some blade page, and I want to extract a price from that selectbox options.

 <select  x-model="service.service"
                                
    name="services[]" 
     class="input rounded-sm">

                            <option   >-- choose service --</option>
                            @foreach ($services as $service)

                                <option x-init="x={{number_format($service->price, 2)}}" value="{{$service->id}}">
                                    {{ $service->name }} (${{ number_format($service->price, 2) }})</p>
                                </option>
                            @endforeach
                        </select>

this code retrives only the last price from the select? it print "Unit Price: 855" and stack on that value.

I want the text change when selecting diffrent value

please dont mention:

value ={{service->prie}}
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda